#ifndef OPENING_RECT_H
#define OPENING_RECT_H

#include "../../anime/utils.h"

using namespace anime;

class OpeningRect
{
public:

    OpeningRect( Animation* src, float _threshold = 0.5, int start = 0, int end = -1 );
    ~OpeningRect( void );

    float x, y, w, h;

private:

    class WidthPropertySetter: public PropertySetter< float >
    {
    public:
        WidthPropertySetter( OpeningRect* _owner );

        virtual void operator()(const float& val);

    private:
        OpeningRect* owner;
    };

    class HeightPropertySetter: public PropertySetter< float >
    {
    public:
        HeightPropertySetter( OpeningRect* _owner );

        virtual void operator()(const float& val);

    private:
        OpeningRect* owner;
    };

    float threshold;

    SimplePropertyGetter< float >* wpg;
    WidthPropertySetter* wps;

    SimplePropertyGetter< float >* hpg;
    HeightPropertySetter* hps;

    Property< float > *pW, *pH;

    ScalarInterpolator< int, float > *wI, *hI;
};

#endif // OPENING_RECT_H
